//package lbsproject.processaudit.misc;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import common.app.constants.StringConstants;
//
//import lbsproject.processaudit.adr.R;
//import lbsproject.processaudit.adr.activities.TaskList;
//import android.app.Activity;
//import android.content.Intent;
//import android.os.Bundle;
//import android.text.format.DateFormat;
//import android.view.Menu;
//import android.view.MenuItem;
//import android.view.View;
//import android.view.View.OnClickListener;
//import android.widget.AdapterView;
//import android.widget.AdapterView.OnItemSelectedListener;
//import android.widget.ArrayAdapter;
//import android.widget.Button;
//import android.widget.Spinner;
//import app.mobile.requestapi.MobileRequests;
//
//
//public class ScreenByCondition {
//
//
//	private ArrayList<SerializableTask> taskListCache;
//
//	private String[] TASK_STATUS_ARRAY;
//	private String[] TASK_RATING_ARRAY;
//	private String[] TASK_TYPE_ARRAY;
//
//	private String taskLocationResult = "";
//	private String createDateResult = "";
//	private String finishDateResult = "";
//	private String taskStatusResult = "";
//	private String taskRatingResult = "";
//	private String taskTypeResult = "";
//
////
////	class OnCreateDateSelectListener implements OnItemSelectedListener {
////
////		@Override
////		public void onItemSelected( AdapterView<?> arg0, View arg1, int pos, long arg3 ) {
////			createDateResult = (String)( (Spinner)arg0 ).getAdapter().getItem( pos );
////			if (createDateResult.equals( getString( R.string.empty ) )) {
////				createDateResult = "";
////			}
////		}
////
////		@Override
////		public void onNothingSelected( AdapterView<?> arg0 ) {
////			
////		}
////
////	}
////
////	class OnFinishDateSelectListener implements OnItemSelectedListener {
////
////		@Override
////		public void onItemSelected( AdapterView<?> arg0, View arg1, int pos, long arg3 ) {
////			finishDateResult = (String)( (Spinner)arg0 ).getAdapter().getItem( pos );
////			if (finishDateResult.equals( getString( R.string.empty ) )) {
////				finishDateResult = "";
////			}
////		}
////
////		@Override
////		public void onNothingSelected( AdapterView<?> arg0 ) {
////			
////		}
////		
////	}
////
////	class OnStatusSelectListener implements OnItemSelectedListener {
////
////		@Override
////		public void onItemSelected( AdapterView<?> arg0, View arg1, int pos, long arg3 ) {
////			taskStatusResult = (String)( (Spinner)arg0 ).getAdapter().getItem( pos );
////			if (taskStatusResult.equals( getString( R.string.empty ) )) {
////				taskStatusResult = "";
////			}
////		}
////
////		@Override
////		public void onNothingSelected( AdapterView<?> arg0 ) {
////			
////		}
////		
////	}
////
////	class OnRatingSelectListener implements OnItemSelectedListener {
////
////		@Override
////		public void onItemSelected( AdapterView<?> arg0, View arg1, int pos, long arg3 ) {
////			taskRatingResult = (String)( (Spinner)arg0 ).getAdapter().getItem( pos );
////			if (taskRatingResult.equals( getString( R.string.empty ) )) {
////				taskRatingResult = "";
////			}
////		}
////
////		@Override
////		public void onNothingSelected( AdapterView<?> arg0 ) {
////			
////		}
////		
////	}
////
////	class OnTypeSelectListener implements OnItemSelectedListener {
////
////		@Override
////		public void onItemSelected( AdapterView<?> arg0, View arg1, int pos, long arg3 ) {
////			taskTypeResult = (String)( (Spinner)arg0 ).getAdapter().getItem( pos );
////			if (taskTypeResult.equals( getString( R.string.empty ) )) {
////				taskTypeResult = "";
////			}
////		}
////
////		@Override
////		public void onNothingSelected( AdapterView<?> arg0 ) {
////
////		}
////		
////	}
////
////	class OnLocationSelectListener implements OnItemSelectedListener {
////
////		@Override
////		public void onItemSelected( AdapterView<?> arg0, View arg1, int pos, long arg3 ) {
////			taskLocationResult = (String)( (Spinner)arg0 ).getAdapter().getItem( pos );
////			if (taskLocationResult.equals( getString( R.string.empty ) )) {
////				taskLocationResult = "";
////			}
////			
////		}
////
////		@Override
////		public void onNothingSelected( AdapterView<?> arg0 ) {
////			
////		}
////		
////	}
////
////	class OnDoneClickListener implements OnClickListener {
////
////		@Override
////		public void onClick( View v ) {
////			ScreenCondition conditions = new ScreenCondition(
////												createDateResult,
////												finishDateResult,
////												taskStatusResult,
////												taskRatingResult,
////												taskTypeResult,
////												taskLocationResult );
////			Intent intent = new Intent();
////			intent.setClass( ScreenByCondition.this, TaskList.class );
////			intent.putExtra( "SCREEN", conditions );
////			startActivity( intent );
////		}
////		
////	}
////
////	@SuppressWarnings( "unchecked" )
////	@Override
////	protected void onCreate( Bundle savedInstanceState ) {
////		super.onCreate( savedInstanceState );
////		setContentView( R.layout.screenbycondition );
////
////		TASK_STATUS_ARRAY = new String[] {
////				getString( R.string.empty ),
////				getString( R.string.created ),
////				getString( R.string.started ),
////				getString( R.string.finished ),
////				getString( R.string.cancelled )
////		};
////		TASK_RATING_ARRAY = new String[] {
////				getString( R.string.empty ),
////				getString( R.string.normal ),
////				getString( R.string.urgent ),
////				getString( R.string.very_urgent )
////		};
////		TASK_TYPE_ARRAY = new String[] {
////				getString( R.string.empty ),
////				getString( R.string.repair ),
////				getString( R.string.check )
////		};
////
////		taskListCache = (ArrayList<SerializableTask>)getIntent().getExtras().get( "TASKS" );
////
////		spinnerTaskLocation = (Spinner)findViewById( R.id.spinnerTaskLocation );
////		spinnerCreateDate = (Spinner)findViewById( R.id.spinnerCreateDate );
////		spinnerFinishDate = (Spinner)findViewById( R.id.spinnerFinishDate );
////		spinnerTaskStatus = (Spinner)findViewById( R.id.spinnerTaskStatus );
////		spinnerTaskRating = (Spinner)findViewById( R.id.spinnerTaskRating );
////		spinnerTaskType = (Spinner)findViewById( R.id.spinnerTaskType );
////
////		btnDone = (Button)findViewById( R.id.btnScreenConditionsDone );
////		btnDone.setOnClickListener( new OnDoneClickListener() );
////
////		setSpinnersContent();
////	}
////
////	private void setSpinnersContent() {
////		ArrayAdapter<String>
////		contentAdapter = new ArrayAdapter<String>(
////								ScreenByCondition.this,
////								android.R.layout.simple_spinner_dropdown_item,
////								genCreateDatesList() );
////		spinnerCreateDate.setAdapter( contentAdapter );
////		spinnerCreateDate.setOnItemSelectedListener( new OnCreateDateSelectListener() );
////
////		contentAdapter = new ArrayAdapter<String>(
////								ScreenByCondition.this,
////								android.R.layout.simple_spinner_dropdown_item,
////								genFinishDatesList() );
////		spinnerFinishDate.setAdapter( contentAdapter );
////		spinnerFinishDate.setOnItemSelectedListener( new OnFinishDateSelectListener() );
////
////		contentAdapter = new ArrayAdapter<String>(
////								ScreenByCondition.this,
////								android.R.layout.simple_spinner_dropdown_item,
////								TASK_STATUS_ARRAY );
////		spinnerTaskStatus.setAdapter( contentAdapter );
////		spinnerTaskStatus.setOnItemSelectedListener( new OnStatusSelectListener() );
////
////		contentAdapter = new ArrayAdapter<String>(
////								ScreenByCondition.this,
////								android.R.layout.simple_spinner_dropdown_item,
////								TASK_RATING_ARRAY );
////		spinnerTaskRating.setAdapter( contentAdapter );
////		spinnerTaskRating.setOnItemSelectedListener( new OnRatingSelectListener() );
////
////		contentAdapter = new ArrayAdapter<String>(
////								ScreenByCondition.this,
////								android.R.layout.simple_spinner_dropdown_item,
////								TASK_TYPE_ARRAY );
////		spinnerTaskType.setAdapter( contentAdapter );
////		spinnerTaskType.setOnItemSelectedListener( new OnTypeSelectListener() );
////
////		contentAdapter = new ArrayAdapter<String>(
////				ScreenByCondition.this,
////				android.R.layout.simple_spinner_dropdown_item,
////				genLocationList() );
////		spinnerTaskLocation.setAdapter( contentAdapter );
////		spinnerTaskLocation.setOnItemSelectedListener( new OnLocationSelectListener() );
////	}
////
////	private List<String> genCreateDatesList() {
////		ArrayList<String> createDates = new ArrayList<String>();
////		createDates.add( getString( R.string.empty ) );
////		for (SerializableTask task: taskListCache) {
////			String date = (String)DateFormat.format( StringConstants.DATE_FORMAT, task.getCreateDate() );
////			if (!createDates.contains( date )) {
////				createDates.add( date );
////			}
////		}
////
////		return createDates;
////	}
////
////	private List<String> genFinishDatesList() {
////		ArrayList<String> finishDates = new ArrayList<String>();
////		finishDates.add( getString( R.string.empty ) );
////		for (SerializableTask task: taskListCache) {
////			String date = (String)DateFormat.format( StringConstants.DATE_FORMAT, task.getFinishDate() );
////			if (!finishDates.contains( date )) {
////				finishDates.add( date );
////			}
////		}
////
////		return finishDates;
////	}
////
////	private List<String> genLocationList() {
////		ArrayList<String> locations = new ArrayList<String>();
////		locations.add( getString( R.string.empty ) );
////		for (SerializableLocation location: MobileRequests.getAvailableLocations()) {
////			locations.add( location.getLocationName() );
////		}
////
////		return locations;
////	}
////
////	@Override
////	public boolean onCreateOptionsMenu( Menu menu ) {
////		MenuItem menuItem = menu.add( 0, 1, 1, R.string.done );
////		menuItem.setIcon( R.drawable.ic_menu_search );
////
////		return super.onCreateOptionsMenu( menu );
////	}
////
////	private void onScreenSettingDone() {
////		ScreenCondition conditions = new ScreenCondition(
////				createDateResult,
////				finishDateResult,
////				taskStatusResult,
////				taskRatingResult,
////				taskTypeResult,
////				taskLocationResult );
////		Intent intent = new Intent();
////		intent.setClass( ScreenByCondition.this, TaskList.class );
////		intent.putExtra( "SCREEN", conditions );
////		startActivity( intent );
////	}
////
////	@Override
////	public boolean onOptionsItemSelected( MenuItem item ) {
////		switch (item.getItemId()) {
////			case 1:
////				onScreenSettingDone();
////				break;
////		}
////
////		return super.onOptionsItemSelected( item );
////	}
//
//}
